//////////////////////////////////////////////////////////////////////////////
//                                                                          //
// Copyright (C) LibG.org. 2008. All rights reserved.                       //
//                                                                          //
// Licensed under GPL, you may use this file except for commercial purpose. //
//                                                                          //
// Permission to use, copy, modify, and distribute this software in object  //
// code form for any purpose and without fee is hereby granted, provided    //
// that the above copyright notice appears in all copies and that both that //
// copyright notice and the limited warranty and restricted rights notice   //
// below appear in all supporting documentation.                            //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////

#ifndef HEADER_GIVECTOR3_H
#define HEADER_GIVECTOR3_H

#include "gitypes.h"
class giPoint3;

class giVector3 : public giValueFloat3
{
public:
    giVector3();
    giVector3( const giVector3& v );
    giVector3( const giDouble& vx, const giDouble& vy, const giDouble& vz );
    void set( const giDouble& vx, const giDouble& vy, const giDouble& vz );

    // assignment operators
    giVector3& operator = ( const giVector3& v );
    giVector3& operator += ( const giVector3& v );
    giVector3& operator -= ( const giVector3& v );
    giVector3& operator *= ( const giDouble& v );
    giVector3& operator /= ( const giDouble& v );

    // unary operators
    giVector3 operator + () const;
    giVector3 operator - () const;

    // arithmatic operators
    giVector3 operator + ( const giVector3& v ) const;
    giVector3 operator - ( const giVector3& v ) const;
    giVector3 operator * ( const giDouble& v ) const;
    giVector3 operator / ( const giDouble& v ) const;

    // relational and equality operators
    bool operator == ( const giVector3& v ) const;
    bool operator != ( const giVector3& v ) const;

    // conversion
    giPoint3    toPoint() const;

    // vector operators
    giDouble    length() const;
    giVector3&  normalize();
    giDouble    dotProduct( const giVector3& v ) const;
    giVector3   crossProduct( const giVector3& v ) const;

    // stock values
    static const giVector3 kXAxis;
    static const giVector3 kYAxis;
    static const giVector3 kZAxis;
    static const giVector3 kZero;

private:
    mutable giDouble len;
};

#endif // HEADER_GIVECTOR3_H